package com.aries.provider.serviceImpl;

import com.alibaba.dubbo.config.annotation.Service;
import com.aries.entitys.UserDO;
import com.aries.entitys.UserService;
import com.aries.provider.service.UserRepoService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.mockuai.commons.entitis.FilterChain;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service(interfaceClass = UserService.class)
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepoService userRepoService;

    @Override
    public UserDO get(String id) {
        return userRepoService.selectById(id);
    }

    @Override
    public List<UserDO> list() {
        return userRepoService.selectList(new EntityWrapper<UserDO>()
                .where("1=1"));
    }

    @Override
    public Boolean insert(UserDO userDO) {
        System.out.println(this.toString());
        return userRepoService.insert(userDO);
    }

    @Override
    public UserDO selectByWrapper(Wrapper<UserDO> entityWrapper) {
        return userRepoService.selectOne(entityWrapper);
    }

    @Override
    public List<UserDO> selectByName(String name) {
        return userRepoService.selectByName(name);
    }

    @Override
    public UserDO getOne(EntityWrapper<UserDO> entityWrapper) {
        return this.userRepoService.selectOne(entityWrapper);
    }

    @Override
    public List<UserDO> selectList(EntityWrapper<UserDO> entityWrapper, FilterChain filterChain) {
        return this.userRepoService.selectList(entityWrapper);
    }

    @Override
    public Page<UserDO> selectPage(Page<UserDO> page, Wrapper<UserDO> wrapper) {
        return this.userRepoService.selectPage(page, wrapper);
    }


}
